<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>LibQQt: QQtSharedMemory Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">LibQQt
   &#160;<span id="projectnumber">v3.1</span>
   </div>
   <div id="projectbrief">开源、跨平台Qt应用程序框架中间件</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="class_q_qt_shared_memory-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">QQtSharedMemory Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>The <a class="el" href="class_q_qt_shared_memory.html" title="The QQtSharedMemory class 共享内存读写实现类。 允许可变长度的局部变量。 ">QQtSharedMemory</a> class 共享内存读写实现类。 允许可变长度的局部变量。  
 <a href="class_q_qt_shared_memory.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="qqtsharedmemory_8h_source.html">qqtsharedmemory.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for QQtSharedMemory:</div>
<div class="dyncontent">
 <div class="center">
  <img src="class_q_qt_shared_memory.png" usemap="#QQtSharedMemory_map" alt=""/>
  <map id="QQtSharedMemory_map" name="QQtSharedMemory_map">
<area href="class_my_value.html" alt="MyValue" shape="rect" coords="0,112,122,136"/>
</map>
 </div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:acd12049275027255b9d2dd5d98247d57"><td class="memItemLeft" align="right" valign="top"><a id="acd12049275027255b9d2dd5d98247d57"></a>
&#160;</td><td class="memItemRight" valign="bottom"><b>QQtSharedMemory</b> (const QString &amp;key, QObject *parent=Q_NULLPTR)</td></tr>
<tr class="separator:acd12049275027255b9d2dd5d98247d57"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a008dc391d81687d334779ebc4284a1a3"><td class="memItemLeft" align="right" valign="top"><a id="a008dc391d81687d334779ebc4284a1a3"></a>
virtual void&#160;</td><td class="memItemRight" valign="bottom"><b>initializer</b> ()</td></tr>
<tr class="separator:a008dc391d81687d334779ebc4284a1a3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a030856c7926179212ad3512d81229702"><td class="memItemLeft" align="right" valign="top"><a id="a030856c7926179212ad3512d81229702"></a>
virtual void&#160;</td><td class="memItemRight" valign="bottom"><b>packer</b> ()</td></tr>
<tr class="separator:a030856c7926179212ad3512d81229702"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a500ea5a43b66f322c2a03da007138180"><td class="memItemLeft" align="right" valign="top"><a id="a500ea5a43b66f322c2a03da007138180"></a>
virtual void&#160;</td><td class="memItemRight" valign="bottom"><b>parser</b> ()</td></tr>
<tr class="separator:a500ea5a43b66f322c2a03da007138180"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9401a48134c6e310054803ffb704b702"><td class="memItemLeft" align="right" valign="top"><a id="a9401a48134c6e310054803ffb704b702"></a>
QByteArray&#160;</td><td class="memItemRight" valign="bottom"><b>readShortString</b> (QByteArray &amp;bytes)</td></tr>
<tr class="separator:a9401a48134c6e310054803ffb704b702"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adfeab4d0ca3c97f884fae62f3bea7428"><td class="memItemLeft" align="right" valign="top"><a id="adfeab4d0ca3c97f884fae62f3bea7428"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>writeShortString</b> (QByteArray &amp;bytes, QByteArray &amp;shortString)</td></tr>
<tr class="separator:adfeab4d0ca3c97f884fae62f3bea7428"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8991be38eb638ba73447e5ccd2c20ab3"><td class="memItemLeft" align="right" valign="top"><a id="a8991be38eb638ba73447e5ccd2c20ab3"></a>
QByteArray&#160;</td><td class="memItemRight" valign="bottom"><b>readString</b> (QByteArray &amp;bytes)</td></tr>
<tr class="separator:a8991be38eb638ba73447e5ccd2c20ab3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a43635e13c1e4e4107711bea73f9c02a9"><td class="memItemLeft" align="right" valign="top"><a id="a43635e13c1e4e4107711bea73f9c02a9"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>writeString</b> (QByteArray &amp;bytes, QByteArray &amp;shortString)</td></tr>
<tr class="separator:a43635e13c1e4e4107711bea73f9c02a9"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>The <a class="el" href="class_q_qt_shared_memory.html" title="The QQtSharedMemory class 共享内存读写实现类。 允许可变长度的局部变量。 ">QQtSharedMemory</a> class 共享内存读写实现类。 允许可变长度的局部变量。 </p>
<p>原理： 在每个个局部变量和共享内存块之间进行数据交换。 业务层从局部变量取值和设值。</p>
<p>使用方法： 1.继承这个类，定义成员变量，允许使用QByteArray。 2.实现packer和parser函数，从共享内存块里顺序读和顺序写数据。 3.create创建内存块，固定大小的内存块，共享内存有这样的约束。 4.attach使内存块在当前线程里生效。 5.不使用了以后，detach。</p>
<p>注意：detach以后需要频繁create和attach，以确保内存没有被释放。 注意：key是确认共享内存的唯一值，可以取作为变量名。 注意：数据结构是保持不变的，改变的是数据结构里面的Value。</p>
<p>1.initializer() 初始化 create attach。特点：内存空间地址是动态会变化的，但是value却保持的。所以频繁create、attach就好了，防止没有create或者attach导致的空间地址为null。 2.共享块数据结构保持，实现packer parser。 3.XXXSharedMemory variable("key"); 特点：第一个，必须保持，static，必须有个保持的，什么都不干，就用来保持就行。 4.variable.initializer(); 特点：每个变量都必须调用！ 5.variable.parser(); XXXSharedMemory内部定义的成员变量就可以使用了。 6.variable.packer(); XXXSharedMemory内部定义的成员变量就写到共享存储块里面了。 7.只要保证写入的总长度小于等于共享存储块的大小就不会出错。读取的时候总长度随便。</p>
<p>约束：共享内存块总长定长，不能变化。内部组成不定长。 </p>
</div><hr/>The documentation for this class was generated from the following file:<ul>
<li>R:/Develop/a0-develop/LibQQt/src/highgrade/<a class="el" href="qqtsharedmemory_8h_source.html">qqtsharedmemory.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.14
</small></address>
</body>
</html>
